package com.itheima.grow.model.other;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.itheima.grow.util.DateUtil;

import java.util.Date;


/**
 * @author: wjw
 * @date: 2022-09-22
 * @description:
 **/

public class BaseEntity extends DBObject {
    private static final long serialVersionUID = 3706388994500474565L;

    public static final String CREATED_BY_SYSTEM = "system";
    public static final String UPDATED_BY_SYSTEM = "system";
    public static final String BY_NONE = "NONE";

    /**
     * 更新者
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public String updatedBy;

    /**
     * 创建者
     */
    @TableField(fill = FieldFill.INSERT)
    public String createdBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateUtil.FORMAT_6,timezone = DateUtil.TIMEZONE_GMT8)
    public Date createdTime;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = DateUtil.FORMAT_6,timezone = DateUtil.TIMEZONE_GMT8)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public Date updatedTime;

    /**
     * 是否删除（0，否，1是）
     */
    @TableLogic(value = "0",delval = "1")
    private Long isDeleted;

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }
}
